package com.xdclass.intertupt;

/**
 * @Author: Timo
 * @Date: 2019/4/26 12:21
 * @Description: 中断,
 *
 */
public class InterruptDemo implements Runnable{

    @Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            System.out.println(" isInterrupted : "+ Thread.currentThread().isInterrupted()+ " thread :"+Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new InterruptDemo());
        thread.start();
        Thread.sleep(1000L);
        thread.interrupt();

    }



}
